'\" t
.\"     Title: ne_session_proxy
.\"    Author: 
.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
.\"      Date: 29 January 2024
.\"    Manual: neon API reference
.\"    Source: neon 0.33.0
.\"  Language: English
.\"
.TH "NE_SESSION_PROXY" "3" "29 January 2024" "neon 0.33.0" "neon API reference"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
ne_session_proxy, ne_session_socks_proxy, ne_session_system_proxy, ne_set_addrlist \- configure proxy servers
.SH "SYNOPSIS"
.sp
.ft B
.nf
#include <ne_session\&.h>
.fi
.ft
.HP \w'void\ ne_session_proxy('u
.BI "void ne_session_proxy(ne_session\ *" "session" ", const\ char\ *" "hostname" ", unsigned\ int\ " "port" ");"
.HP \w'void\ ne_session_system_proxy('u
.BI "void ne_session_system_proxy(ne_session\ *" "session" ", unsigned\ int\ " "flags" ");"
.HP \w'void\ ne_session_socks_proxy('u
.BI "void ne_session_socks_proxy(ne_session\ *" "session" ", enum\ ne_sock_sversion\ " "version" ", const\ char\ *" "hostname" ", unsigned\ int\ " "port" ", const\ char\ *" "username" ", const\ char\ *" "password" ");"
.HP \w'void\ ne_set_addrlist('u
.BI "void ne_set_addrlist(ne_session\ *" "session" ", const\ ne_inet_addr\ **" "addrlist" ", size_t\ " "count" ");"
.SH "DESCRIPTION"
.PP
One (and no more than one) of the functions
\fBne_session_proxy\fR,
\fBne_session_system_proxy\fR,
\fBne_session_socks_proxy\fR,
\fBne_set_addrlist\fR
can be used to configure a proxy server for a given session object\&. If more than one function is invoked for any given session object, only the last call has effect\&. If one of the functions is to be used, it must be used before the creation of any request object for the session\&.
.SS "HTTP proxy specification"
.PP
The
\fBne_session_proxy\fR
function configures use of an HTTP proxy server for the session, the location of which is given by the
\fIhostname\fR
and
\fIport\fR
parameters\&. If the proxy requires authentication,
ne_set_proxy_auth
should be used\&.
.SS "System proxy configuration"
.PP
The
\fBne_session_system_proxy\fR
function configures the session to use any proxy servers specified by the system configuration\&. Support for this function is platform\-specific; if unsupported, the function has no effect\&.
.SS "SOCKS proxy configuration"
.PP
The
\fBne_session_socks_proxy\fR
function configures the session to use a SOCKS proxy\&. The
\fIversion\fR
indicates which version of the SOCKS protocol should be used\&. The
\fIhostname\fR
and
\fIport\fR
parameters specify the SOCKS proxy location\&. Note that a server with only an IPv6 address cannot be used with SOCKS v4 or v4A\&. The interpretation of the other arguments depends on the version specified:
.PP
\fBNE_SOCK_SOCKSV4\fR (version 4)
.RS 4
The
\fIusername\fR
parameter must be non\-NULL; the
\fIpassword\fR
parameter is ignored\&.
.RE
.PP
\fBNE_SOCK_SOCKSV4A\fR (version 4A)
.RS 4
The
\fIusername\fR
parameter must be non\-NULL; the
\fIpassword\fR
parameter is ignored\&.
.RE
.PP
\fBNE_SOCK_SOCKSV5\fR (version 5)
.RS 4
The
\fIusername\fR
parameter may be
NULL; if it is non\-NULL, the
\fIpassword\fR
parameter must also be non\-NULL; otherwise, it is ignored\&.\&.
.RE
.SS "Origin server address override"
.PP
The
\fBne_set_addrlist\fR
function forces use of an address and port the a specified list when establishing a TCP connection, ignoring the "real" hostname and port identifying the origin server for the session (as passed to
\fBne_session_create\fR)\&. The origin server\*(Aqs "real" hostname and port will still be used in the
Host
header in HTTP requests\&. When a connection is required, the library will iterate through the
\fIaddrlist\fR
list, attempting to connect to the address
\fIaddrlist[0]\fR
through to
\fIaddrlist[count\-1]\fR
in turn, until a connection can be established\&.
.SH "RETURN VALUES"
.PP
None of the functions described here has a return value\&.
.SH "EXAMPLES"
.PP
Create and destroy a session:
.sp
.if n \{\
.RS 4
.\}
.nf
ne_session *sess;
sess = ne_session_create("http", "host\&.example\&.com", 80);
ne_session_proxy(sess, "proxy\&.example\&.com", 3128);
/* \&.\&.\&. use sess \&.\&.\&. */
ne_session_destroy(sess);
.fi
.if n \{\
.RE
.\}
.SH "SEE ALSO"
.PP
ne_ssl_set_verify,
ne_ssl_trust_cert,
ne_sock_init,
ne_set_session_flag
.SH "AUTHOR"
.PP
\fBJoe Orton\fR
.RS 4
Author.
.RE
.SH "COPYRIGHT"
.br
